import { Toast } from 'antd-mobile';

type Content = JSX.Element|string;

interface ILogger {
    content: Content;
    duration?: number;
    onClose?: VoidFunction;
    mask?: boolean;
    type?: string;
}

export function ToastLog(Logger: ILogger) {
    return (target: React.Component,prop:string) => {
        const type: string = Logger.type ? Logger.type : 'info';
        Toast[type](Logger.content,Logger.duration,Logger.onClose,Logger.type);
    }
}

export function ConsoleLog(info: string) {
    return (target: React.Component,prop:string) => {
        console.log(`${prop}: ${info}`);
    }
}